package com.zq.jichu;

public class AbstractTest {
    public static void main(String[] args) {
        Animal dog = new Dog("旺财", 12);
        dog.eat();
        dog.run();
    }
}
class Dog extends Animal{
    public Dog(String name, int age) {
        super(name, age);
    }

    public Dog() {
    }

    @Override
    public void eat() {
        System.out.println("小狗在吃饭");
    }

    @Override
    public void run() {
        System.out.println("小狗在跑步");
    }
}

abstract class Animal{
    private String name;
    private int age;

    public abstract void eat();
    public abstract void run();
    public Animal(String name, int age) {
        this.name = name;
        this.age = age;
    }

    public Animal() {
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }
}
